#pragma once


#include <ctime>
#include <string>
#include <stdio.h>
#include <iostream>

static void print_local_time()
{
    time_t tm;
    struct tm *lt;
    time(&tm);
    lt = std::localtime(const_cast<time_t *>(&tm));
    printf("%d:%d:%d ",lt->tm_hour, lt->tm_min, lt->tm_sec);
}

#ifndef DEBUG
#define DEBUG 1
#endif

#if DEBUG

#define ALOGD(...) \
    do { \
        print_local_time(); \
        printf("D: %s:[%d] ",__FUNCTION__, __LINE__); \
        printf(__VA_ARGS__); \
        printf("\n"); \
    }while(0)

#define ALOGE(...) \
    do { \
        print_local_time(); \
        printf("E: %s:[%d] ",__FUNCTION__, __LINE__); \
        printf(__VA_ARGS__); \
        printf("\n"); \
    }while(0)

#else

#define ALOGD(...) (void)(0)
#define ALOGE(...) (void)(0)

#endif
